package com.yitao.cms.config.permission.Interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @Auther: wuwenlong
 * @Date: 2018/6/11 0011 14:25
 * @Description:拦截器配置
 */
@Configuration
public class MyWebConfig extends WebMvcConfigurerAdapter{

    @Bean
    public HandlerInterceptor getHandlerInterceptor(){
        return new PermissionHandlerInterceptor();
    }

    /**
     * 注册 拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(getHandlerInterceptor())
                .excludePathPatterns("/yitao/user/login","/v2/api-docs");
        super.addInterceptors(registry);
    }
}
